import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import "./styles/style.scss"
Vue.config.productionTip = false
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

router.beforeEach((to, from, next) => {
 
  var token = localStorage.getItem("token");
  if(to.path == "/login"){
    next()
  }else{
    if(token){
      next()
    }else{
      alert("暂未登录,跳转到登录界面");
      next("/login")
    }
  }
  
})
Vue.use(ElementUI);
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
